﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
public  class BlackWallEffectControl : UIBase
{
    public GameObject effectObj;
    public Button sikpBtn;
    public static bool isOk;
    // Start is called before the first frame update
    void Start()
    {
        EffectInit();
    }

    // Update is called once per frame
    void Update()
    {
    }
    public void EffectInit() {
        GameObject obj= Resources.Load<GameObject>("BlackEffect");
        effectObj =Instantiate(obj, GameObject.Find("Canvas").transform);
        sikpBtn = effectObj.transform.GetChild(4).gameObject.GetComponent<Button>();
        sikpBtn.onClick.AddListener(delegate ()
        {
            BlackOut();
            EffectDis();
            Invoke("BlackInit", 1.5f);
        });
        BlackInit();
    }
    public void EffectDis() {   
         Destroy(effectObj.gameObject, 1.5f);
        Destroy(this.gameObject.GetComponent<BlackWallEffectControl>(), 2f);
    }

}
